<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="/HomeTemplate.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                >
    <ui:define name="body">
        
        <div class="main-container" >
        
        <h:form>
            <p:panelGrid columns="2">
                <p:column>
        <p:panelMenu style="width:200px; text-align: left">
            <p:submenu label="Dealers" >
                <p:menuitem value="Dealer Managment" icon="ui-icon-bullet" />
            
        </p:submenu>
        <p:submenu label="Order">
            <p:menuitem value="Brand Managment "  icon="ui-icon-bullet" url="AdminParametricBrand.xhtml"/>
            <p:menuitem value="Product Type Managment "  icon="ui-icon-bullet" url="AdminParametricProduct.xhtml" />
            <p:menuitem value="Category Managment"   icon="ui-icon-bullet" url="AdminParametricCategory.xhtml"/>
            <p:menuitem value="Catalog Managment"  icon="ui-icon-bullet" url="AdminParametricCatalog.xhtml"/>
            <p:menuitem value="Inventory Managment"  icon="ui-icon-bullet" url="AdminParametricInventory.xhtml"/>
        </p:submenu>
         <p:submenu label="Account">
            <p:menuitem value="Delete"   icon="ui-icon-bullet"/>
        </p:submenu>
        <p:submenu label="Warranty" >
            <p:submenu label="Links" icon="ui-icon-bullet">
                <p:submenu label="PrimeFaces" icon="ui-icon-bullet">
                    <p:menuitem value="Home" url="http://www.primefaces.org" icon="ui-icon-bullet" />
                </p:submenu>
            </p:submenu>
            <p:menuitem value="Mobile" icon="ui-icon-bullet" />
        </p:submenu>
        <p:submenu label="Marketing">
            <p:menuitem value="Save" icon="ui-icon-bullet" />
            
        </p:submenu>
       
        
    </p:panelMenu>
             </p:column>  
                <p:column>
                <p:row> 
                    <p:panel header="Dealers List">
                           
                             
                             <h:outputText value="VAT No"/>
                             <p:inputText value="#{dealer.numDoc}" /> 
                             
                             <h:outputText value="Dealer Type"/>
                             <p:inputText value="#{dealer.numDoc}" /> 
                             
                              <h:outputText value="Status"/>
                             <p:inputText value="#{dealer.numDoc}" />  
                        
                    </p:panel>
                </p:row>
                <p:row>
    <p:dataTable id="dataTable" var="dealer" value="#{loginBean.dealersByUser}" widgetVar="dealerTable" paginator="true"
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks}
                         {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" paginatorPosition="bottom"
                         rows="7" rowsPerPageTemplate="7,14,21" 
                         >  
                
                <p:column >  
                    <f:facet name="header">  
                        User Name
                    </f:facet>  

                    <h:outputText value="#{dealer.userName}" />  

                </p:column> 
                 <p:column >  
                    <f:facet name="header">  
                        Company Name
                    </f:facet>  

                    <h:outputText value="" />  

                </p:column>  
                 <p:column >  
                    <f:facet name="header">  
                        Contact Person
                    </f:facet>  

                    <h:outputText value="#{dealer.userName}" />  

                </p:column>  

                <p:column >  
                    <f:facet name="header">  
                        ID No / VAT No
                    </f:facet>  

                    <h:outputText value="#{dealer.numDoc}" />  

                </p:column>  
                <p:column >  
                    <f:facet name="header">  
                        Email
                    </f:facet>  

                    <h:outputText value="#{dealer.email}" />  

                </p:column> 
                 <p:column >  
                    <f:facet name="header">  
                       Dealer Type
                    </f:facet>  

                    <h:outputText value="#{dealer.userName}" />  

                </p:column> 
                 <p:column >  
                    <f:facet name="header">  
                       Status
                    </f:facet>  

                    <h:outputText value="" />  

                </p:column> 

                <f:facet name="footer">  
                    In total there are #{loginBean.dealersByUser.size()} Items.  
                </f:facet>  

            </p:dataTable> 


                    <p:column id="buttons">  
                <p:commandButton  value="Add" onclick="panelwv.show();"  type="button" > </p:commandButton>   
                    </p:column>

            <p:panel id="editPanel" header="Create Dealer User" widgetVar="panelwv" visible="false" style="margin-top: 10px" >  
                <h:panelGrid  >
                    
                    <p:row>
                        <p:column>
                            <h:outputText value="User Name: *" />   
                            <p:inputText id="nam" value="#{loginBean.userDealer.userName}" required="true" label="Username"/>  
                        </p:column>
                        <p:column>
                            <h:outputText value="Password: *" />   
                            <p:password id="desc" value="#{loginBean.userDealer.password}" required="true" label="Password"/> 
                        </p:column>
                        <p:column>
                            <h:outputText value="Dealer Type: *" />   
                            <p:password id="dealerType" value="#{loginBean.userDealer.password}" required="true" label="DealerType"/> 
                        </p:column>
                    </p:row>
                    <p:row>
                        <p:column>
                            <h:outputText value="Company Name: *" />   
                            <p:inputText id="companyName" value="#{loginBean.userDealer.email}" required="true" label="CompanyName" style="width: 300px"/> 
                        </p:column>
                        <p:column>
                            <h:outputText value="VAT No: *" />   
                            <p:inputText id="vat" value="#{loginBean.userDealer.numDoc}" label="Vat"/> 
                       </p:column>
                        <p:column>
                            <h:outputText value="VAT Office: *" />   
                            <p:inputText id="vatOffice" value="#{loginBean.userDealer.numDoc}" label="VatOffice"/> 
                       </p:column>
                     </p:row>
                     <p:row>
                         <p:column>
                            <h:outputText value="Comercial Registration: " />   
                            <p:inputText id="comercialRegis" value="#{loginBean.userDealer.numDoc}" label="Comercial"/> 
                       </p:column>
                         <p:column>
                            <h:outputText value="Address: *" />   
                            <p:inputText id="address" value="#{loginBean.userDealer.numDoc}" label="Address" style="width: 500px"/> 
                       </p:column>
                    </p:row>
                     <p:row>
                    <p:column>
                            <h:outputText value="Contact Name: *" />   
                            <p:inputText id="contactName" value="#{loginBean.userDealer.email}" required="true" label="ContactName"/> 
                        </p:column>
                        <p:column>
                            <h:outputText value="Contact Last Name: *" />   
                            <p:inputText id="contactLastName" value="#{loginBean.userDealer.numDoc}" label="ContactLastName"/> 
                       </p:column>
                       </p:row>
                        <p:row>
                       <p:column>
                            <h:outputText value="Email: *" />   
                            <p:inputText id="email" value="#{loginBean.userDealer.email}" required="true" label="Email" style="width: 400px"/> 
                        </p:column>
                        <p:column>
                            <h:outputText value="Phone: " />   
                            <p:inputText id="telephone" value="#{loginBean.userDealer.numDoc}" label="Telephone"/> 
                       </p:column>
                    <p:column>
                            <h:outputText value="Mobile: " />   
                            <p:inputText id="mobile" value="#{loginBean.userDealer.numDoc}" label="Mobile"/> 
                       </p:column>
                       </p:row>
                 </h:panelGrid>
                    <p:message id="textOnlyMessage" for="nam" display="text" /> 
                    <p:message id="textOnlyMessage2" for="desc" display="text" />
                    <p:message id="textOnlyMessage3" for="email" display="text" />
                  
                    <p:commandButton value="Save" actionListener="#{loginBean.createUserDealer()}" update="dataTable, textOnlyMessage, textOnlyMessage2, textOnlyMessage3" oncomplete="panelwv.hide();"/>

                    <p:commandButton value="Cancel" ajax="true" onclick="panelwv.hide();" immediate="true">

                    </p:commandButton> 
            </p:panel>  
    </p:row> 
                    </p:column>
</p:panelGrid>
</h:form>
  </div>
    </ui:define>
</ui:composition>

